<?php
	define("SUCCESS", 1);
	define("INPUT", 0);
	
	abstract class Action {
		protected $url;
		protected $error;
		protected $action_object;
		
		public function __construct() {
			$this->url = "http://" . $_SERVER["SERVER_ADDR"] . "/siscoc/";
			$this->error = NULL;
		}
		
		public abstract function get_data();
		
		public abstract function validate_data();
		
		public function execute() {
			$this->get_data();
			$this->validate_data();
			if($this->get_error() != NULL && count($this->get_error()) != 0) return INPUT;
			
			return SUCCESS;
		}
		
		public abstract function status($result);
		
		public function get_url() {
			return $this->url;
		}
		
		public function set_url($url) {
			$this->url = $url;
		}
		
		public function get_error() {
			return $this->error;
		}
		
		public function set_error($error) {
			$this->error = $error;
		}
		
		public function get_action_object() {
			return $this->action_object;
		}
		
		public function set_action_object($action_object) {
			$this->action_object = $action_object;
		}
		
		public function redirect($status) {
			header("Expires: Mon, 29 May 1981 08:00:00 GMT");
			header("Cache-Control: no-store, no-cache, must-revalidate");
			header("Cache-Control: post-check=0, pre-check=0", FALSE);
			header("Pragma: no-cache");
			header("Location: " . $this->get_url() . $status);
			die;
		}
	}
?>